package com.tanhua.server.service.impl;

import com.tanhua.dubbo.api.UserlocationApi;
import com.tanhua.model.vo.ErrorResult;
import com.tanhua.server.exception.BusinessException;
import com.tanhua.server.interceptor.UserHolder;
import com.tanhua.server.service.BaiduService;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class BaiduServiceImpl implements BaiduService {

    @DubboReference
    private UserlocationApi userlocationApi;

    @Override
    public void location(Double latitude, Double longitude, String addrStr) {
        Boolean flag = userlocationApi.updateLocation(UserHolder.getUserId(),latitude,longitude,addrStr);
        if (!flag){
            throw new BusinessException(ErrorResult.error());
        }
    }
}
